<?php

https://github.com/Homebrew/brew

http://www.zjl.me/2020/12/16/big-sur-%E6%9B%B4%E6%96%B0-brew-%E8%B8%A9%E5%9D%91/



brew install autoconf
brew install automake
brew install libtool
brew install m4
brew install pkg-config


makefile
https://blog.csdn.net/u010020404/article/details/82770848


Cannot find config.m4. 
cp ./config0.m4 ./config.m4


sudo bash 编译

configure: error: Package requirements (zlib >= 1.2.0.4) were not met:

brew install zlib
brew upgrade openssl@1.1
brew install rbenv/tap/openssl@1.0
export LDFLAGS="/usr/local/opt/openssl@1.0/lib"
export CPPFLAGS="/usr/local/opt/openssl@1.0/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig"


tar -xf php-8.0.3.tar.gz
cd php-8.0.3

/Users/modongxiao/Downloads/php-8.0.3

BZip2编译安装方法
https://sourceforge.net/projects/bzip2/
https://shipengliang.com/software-exp/bzip2%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85%E6%96%B9%E6%B3%95.html
make && make install PREFIX=/usr/local/software/bzip2


编译安装libcurl(附使用示例)
http://www.360doc.com/content/12/0721/15/2660674_225628371.shtml
https://blog.csdn.net/qianghaohao/article/details/51684862
./configure --enable-debug --prefix=/usr/local/software/curl_v2
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/software/curl_v2/lib/pkgconfig


configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>
brew install libiconv
http://www.02405.com/soft/mac/1764.html

https://www.cnblogs.com/cndavidwang/p/12343847.html
https://github.com/kkos/oniguruma
--enable-mbstring
checking for oniguruma... no
autoreconf -vfi
./configure --prefix=/usr/local/software/oniguruma
 /usr/local/bin/gmkdir -p '/usr/local/software/oniguruma/bin'
 /usr/local/bin/ginstall -c onig-config '/usr/local/software/oniguruma/bin'
 /usr/local/bin/gmkdir -p '/usr/local/software/oniguruma/lib/pkgconfig'
 /usr/local/bin/ginstall -c -m 644 oniguruma.pc '/usr/local/software/oniguruma/lib/pkgconfig'
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/software/oniguruma/lib/pkgconfig

https://www.cnblogs.com/zengjfgit/p/4943316.html
https://github.com/libusb/libusb
checking for libedit... no
autoreconf -vfi
./configure --prefix=/usr/local/software/libedit
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/software/libedit/lib/pkgconfig



http://xmlsoft.org/sources/libxml2-2.9.8.tar.gz
./configure --prefix=/usr/local/software/libxml2
make && make install



https://github.com/libgd/libgd
autoreconf -vfi
./configure --prefix=/usr/local/software/libgd



export PKG_CONFIG_PATH=/usr/local/software/curl_v2/lib/pkgconfig:/usr/local/software/oniguruma/lib/pkgconfig:/usr/local/software/libedit/lib/pkgconfig:/usr/local/software/libxml2/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig:/usr/local/software/libgd/lib/pkgconfig

./configure --prefix=/usr/local/software/php8 --enable-fpm --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mhash --with-openssl --with-zlib-dir=/usr/local/software/openssl@1.1 --with-bz2=/usr/local/software/bzip2 --enable-mbstring --enable-sockets --with-iconv=/usr/local/opt/libiconv/ --with-pear --enable-shared --enable-bcmath --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-mbregex --enable-pcntl --enable-exif --with-curl --enable-gd --with-external-gd --with-webp --with-jpeg --with-xpm --with-freetype --with-gettext

#./configure --prefix=/usr/local/software/php8 --enable-fpm --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mhash --with-openssl --with-zlib-dir=/usr/local/software/openssl@1.1 --with-bz2=/usr/local/software/bzip2 --enable-mbstring --enable-sockets --with-iconv=/usr/local/opt/libiconv/ --with-pear --enable-shared --enable-bcmath --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-mbregex --enable-pcntl --enable-exif --enable-gd --with-external-gd --with-webp --with-jpeg --with-xpm --with-freetype --with-gettext


make -j 8
make install
cp php.ini-development /usr/local/software/php8/lib/php.ini
cd /usr/local/software/php8/etc
cp php-fpm.conf.default php-fpm.conf
cp ./php-fpm.d/www.conf.default ./php-fpm.d/www.conf
chmod -R 777 /usr/local/software/php8/var/log





https://github.com/openssl/openssl
./config --prefix=/usr/local/software/openssl@1.1



php 编译安装 configure 指定的参数详解
https://www.cnblogs.com/liyuanhong/articles/12017549.html


modongxiaodeMacBook-Pro:Cellar modongxiao$ brew install zlib
==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/bottles/zlib-1.2.11.big_sur.bottle.tar.gz
######################################################################## 100.0%
==> Pouring zlib-1.2.11.big_sur.bottle.tar.gz
==> Caveats
zlib is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

For compilers to find zlib you may need to set:
  export LDFLAGS="-L/usr/local/opt/zlib/lib"
  export CPPFLAGS="-I/usr/local/opt/zlib/include"

For pkg-config to find zlib you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/zlib/1.2.11: 12 files, 413.6KB
modongxiaodeMacBook-Pro:Cellar modongxiao$ which zlib


export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

# zlib
export LDFLAGS="/usr/local/opt/zlib/lib"
export CPPFLAGS="/usr/local/opt/zlib/include"
export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"

# openssl
export LDFLAGS="/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="/usr/local/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"




curl 安装：
用phpize扩展模块时，报Cannot find config.m4错误: https://blog.csdn.net/zmq5200/article/details/80200446
/usr/local/software/php8/bin/phpize
./configure --with-php-config=/usr/local/software/php8/bin/php-config --with-curl=/usr/local/software/curl_v2
make && make install
/usr/local/software/php8/bin/php -m | grep curl
//  /usr/local/software/php8/lib/php/extensions/no-debug-non-zts-20200930
/usr/local/software/curl_v2/bin/curl --version